#ifndef MESH_OBJECT_HPP
#define MESH_OBJECT_HPP

#include "../Material/Material.hpp"
#include "../Model/MeshBuffer.hpp"
#include "../Program/ProgramState.hpp"
#include "IRenderer.hpp"

namespace Renderer {

/* Single Mesh Renderer */
class MeshRenderer : IRenderer {
public:
  virtual void Draw();

public:
  /*
    TODO: 材质类
   */
  MeshRenderer(const Model::MeshBuffer &mesh);

  MeshRenderer() : _id(0), _buffer(nullptr), _material() {}

  ~MeshRenderer();

  void SetBuffer(const Model::MeshBuffer &mesh) { _buffer = mesh; }

protected:
  void Init();

  virtual void BeforeDraw();

  virtual void EndDraw();

private:
  uint32_t _id;
  Model::MeshBuffer _buffer;
  Material::MaterialBase _material;
};

} // namespace Renderer

#endif